<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*, model.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<html:html>
<HEAD>
<TITLE>Sign in, Please!</TITLE>
</HEAD>
<BODY>
	<html:errors />
	
	<%@page import="model.*;"%>
	<%		   		
		   		Applicant applicant = (Applicant)session.getAttribute("applicant");
				out.println(applicant.getName());
		   		
		   		String country = (String) request.getParameter("country");
		   		out.println(country);
		   		applicant.setCitizenship(country);

		   		session.setAttribute("applicant", applicant);
		

			Vector<String> countriesVector = (Vector) session.getAttribute("countriesVector");
	%>
		
	<%="Name: " + applicant.getName() %><br />
	<%= "Country of Citizenship: " + applicant.getCitizenship() %>

	<hr /><br /> Enter your Original Location of Residence! <br /><br />

	<html:link action="/residence">
		<html:param name="country" value="<%= country %>" />
		Same as country of citizenship <br>
	</html:link> 

	<table>
		<tr>
			<td>
				<% 	int count = countriesVector.size();
						for(int i=0; i<count/3 + 1; i++){%> 
							<html:link action="/residence">
								<html:param name="country" value="<%= countriesVector.get(i)%>" />
								<%= countriesVector.get(i)%><br>
							</html:link> 
					<%	} %>
			</td>
			<td>
				<% for(int i=count/3 + 1; i < (count/3)*2 + 1; i++){ %>
					<html:link action="/residence">
						<html:param name="country" value="<%= countriesVector.get(i)%>" />
						<%= countriesVector.get(i)%><br>
					</html:link> 
					<%} %>
			</td>
			<td>
				<% 	for(int i = (count/3)*2 + 1; i<count; i++){ %>
						 <html:link action="/residence">
							<html:param name="country" value="<%= countriesVector.get(i)%>" />
							<%= countriesVector.get(i)%><br>
						 </html:link> 
					<%}%>
			</td>
		</tr>
	</table>


</BODY>
</html:html>